package priv.jesse.mall.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import priv.jesse.mall.dao.ProductCommentDao;
import priv.jesse.mall.entity.ProductComment;
import priv.jesse.mall.service.ProductCommentService;

import java.util.ArrayList;
import java.util.List;

/**
  * @className: ProductCommentServiceImpl
  * @description: 
  * @author: cy
  * @date: 2019-10-14 
 */
@Service
public class ProductCommentServiceImpl implements ProductCommentService {
    @Autowired
    private ProductCommentDao productCommentDao;

    @Override
    public List<ProductComment> findCommentById(Integer id,Integer curPageNO) {
        Integer start=(curPageNO-1)*20;

        return productCommentDao.findComment(id,start,20);
    }


    /**
     * 创建
     *
     * @param productComment
     * @return
     */
    @Override
    public int create(ProductComment productComment){
        return productCommentDao.save(productComment).getId();
    }


    @Override
    public int findCountById(Integer id){
        return productCommentDao.findCountById(id);
    }


}
